﻿package mortal.game.view.changeCareer
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.component.gconst.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class ChangeCareerItem extends GSprite
    {
        private var _btn:GLoadingButton;
        private var _icon:GImageBitmap;
        private var _iconCareer:GImageBitmap;
        private var _career:int;
        private var _selected:Boolean = false;

        public function ChangeCareerItem()
        {
            return;
        }// end function

        public function get career() : int
        {
            return this._career;
        }// end function

        public function updateCareer(param1:int, param2:int) : void
        {
            this._career = param1;
            this._icon.imgUrl = "ChangeCareer_" + param1 + "_" + param2;
            this._iconCareer.imgUrl = "ChangeCareer_" + param1;
            return;
        }// end function

        public function get selected() : Boolean
        {
            return this._selected;
        }// end function

        public function set selected(param1:Boolean) : void
        {
            this._selected = param1;
            if (param1)
            {
                this._btn.filters = [FilterConst.guideFilter];
            }
            else
            {
                this._btn.filters = [];
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseChildren = true;
            this.mouseEnabled = true;
            this._btn = UIFactory.gLoadingButton(ImagesConst.changeCareerIconBtn_upSkin, 0, 0, 135, 213, this);
            this._icon = UIFactory.gImageBitmap(null, 16, 18, this);
            this._iconCareer = UIFactory.gImageBitmap(null, 35, 157, this);
            this.configEventListener(MouseEvent.MOUSE_OVER, this.mouseOverHandler);
            this.configEventListener(MouseEvent.MOUSE_OUT, this.mouseOutHandler);
            return;
        }// end function

        private function mouseOverHandler(param1) : void
        {
            this._btn.filters = [FilterConst.guideFilter];
            return;
        }// end function

        private function mouseOutHandler(param1) : void
        {
            this.selected = this._selected;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._btn.filters = [];
            this._btn.dispose(param1);
            this._btn = null;
            this._icon.dispose(param1);
            this._icon = null;
            this._iconCareer.dispose(param1);
            this._iconCareer = null;
            this._selected = false;
            return;
        }// end function

    }
}
